home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue45 / Clinic / ClientForm3U.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  2000-11-02  |  970 b   |  49 lines

  1. unit ClientForm3U;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  7.   StdCtrls, ExtCtrls, CorbaObj;
  8.  
  9. type
  10.   TForm1 = class(TForm)
  11.     Timer1: TTimer;
  12.     Label1: TLabel;
  13.     procedure FormCreate(Sender: TObject);
  14.     procedure Timer1Timer(Sender: TObject);
  15.   public
  16.     Server: TAny;
  17.   end;
  18.  
  19. var
  20.   Form1: TForm1;
  21.  
  22. implementation
  23.  
  24. {$R *.DFM}
  25.  
  26. procedure TForm1.FormCreate(Sender: TObject);
  27. var
  28.   Factory: TAny;
  29. begin
  30.   Factory := CorbaBind('IDL:Server/TestFactory:1.0');
  31.   Server := Factory.CreateInstance('');
  32.   Timer1.Enabled := True
  33. end;
  34.  
  35. procedure TForm1.Timer1Timer(Sender: TObject);
  36. begin
  37.   try
  38.     Label1.Caption := DateTimeToStr(Server.Get_DateAndTime)
  39.   except
  40.     on E: Exception do
  41.     begin
  42.       Timer1.Enabled := False;
  43.       Label1.Caption := Format('Server not available (an %s exception occurred, saying "%s")', [E.ClassName, E.Message])
  44.     end
  45.   end
  46. end;
  47.  
  48. end.
  49.